import uuid

from tools import db


def gen_id():
    return uuid.uuid4()


class NeutronAgent(db.Model):
    __tablename__ = "api_neutron_agent"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    host = db.Column(db.String(120), index=True)
    started_at = db.Column(db.String(120), index=True)


class VmPortName(db.Model):
    __tablename__ = "api_vm_port"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    vm_name = db.Column(db.String(120), index=True)
    port_id = db.Column(db.String(120), index=True)
    range_uuid = db.Column(db.String(40))
    vm_uuid = db.Column(db.String(120), index=True)
    ip = db.Column(db.String(20), index=True)


class TapFlow(db.Model):
    __tablename__ = "api_tap_flow"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    tap_service = db.Column(db.String(120), index=True)
    flow_id = db.Column(db.String(120), index=True)
    source_port_id = db.Column(db.String(120))
    host = db.Column(db.String(120), index=True)
    range_uuid = db.Column(db.String(40))


class TapService(db.Model):
    __tablename__ = "api_tap_service"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    tap_service = db.Column(db.String(120), index=True)
    port_id = db.Column(db.String(120))
    range_uuid = db.Column(db.String(40))
